<%--各个区域的用户列表页面--%>
<%@ page import="pojo.User" %>
<%@ page import="dao.ImplementUser" %>
<%@ page import="java.util.ArrayList" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<style>
    .users{
        margin: auto;
        margin-left: 200px;
    }
    .back{
        margin-left: 770px;
    }
</style>
<body>
<h3 align="center">用户</h3>
<a href="areanote.jsp" type="submit" class="back">返回</a>
<table class="users" border="1" width="500" align="center">
    <tr>
        <th>姓名</th>
        <th>年龄</th>
        <th>性别</th>
        <th>电话</th>
        <th>操作</th>
    </tr>
    <%
       String type= (String) session.getAttribute("type");
        ArrayList<User> areausers=new ArrayList<>();
        ImplementUser implementUser=new ImplementUser();
        areausers=implementUser.areaUsers(type);
        request.setAttribute("areausers",areausers);
    %>
    <c:forEach items="${areausers}" var="user" varStatus="s">
        <tr>
            <td>${user.usename}</td>
            <td>${user.age}</td>
            <td>${user.gender}</td>
            <td>${user.telephone}</td>
            <c:if test="${user.addpower==0}">
            <td><a href="${pageContext.request.contextPath}/addAreaUserServlet?usename=${user.usename}" type="submit">取消禁止</a></td>
        </c:if>
            <c:if test="${user.addpower==1}">
                <td><a href="${pageContext.request.contextPath}/stopAreaUserServlet?usename=${user.usename}" type="submit" >禁止发布</a></td>
            </c:if>
        </tr>
    </c:forEach>
</table>
</body>
</html>
